package com.yunti.yntk.manager;

import android.content.Context;
import android.content.SharedPreferences;

public class ConfigManager {

    private SharedPreferences sp;

    private SharedPreferences.Editor editor;

    public void init(Context context) {
        sp = context.getSharedPreferences("config", 0);
        editor = sp.edit();
    }



    private static class HolderClass {
        private static final ConfigManager instance = new ConfigManager();
    }

    public static ConfigManager getInstance() {
        return HolderClass.instance;
    }

    private ConfigManager() {

    }

    public String getApiAddress() {
        String str = sp.getString("apiAddress", null);
        if (str == null) {
            return "http://www.kmyunti.com/";
        }
        return str;
    }

    public String getIpAddress() {
        String str = sp.getString("apiAddress", null);
        if (str == null) {
            return "http://www.kmyunti.com/bzExamApi";
        }
        return str;
    }



    public void setAutoReady(boolean openAutoReady) {
        editor.putBoolean("autoReady", openAutoReady);
        editor.apply();
    }
    public boolean getAutoReady() {
        return sp.getBoolean("autoReady", true);
    }

}
